﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Enterprise.Management.Caches;
using System.Text;
using System.Text.RegularExpressions;
using Enterprise.Management.Common;
using Enterprise.Management.Interfaces;

namespace Enterprise.Management.Business
{
    public class LoginBLL
    {
        private ILoginCache provider = LoginCache.GetCacheProvider();
        public int UserId { get; set; }

        public bool Logged
        {
            get { return UserId > 0; }
        }

        public LoginBLL()
        { }

        public LoginBLL(int userid)
        {
            this.UserId = userid;
        }

        public void Cache()
        {
            if (this.UserId <= 0) return;
            provider.Cache(this.UserId);
        }

        public void Load()
        {
            this.UserId = provider.GetUserId();
        }
    }
}